const fs = require("fs")

function getPromise(filename) {
    return new Promise((resolve, reject) => {
        fs.readFile(`${__dirname}/${filename}.txt`, 'utf-8', (err, data) => {
            if (err) {
                reject(err)
            } else {
                resolve(data)
            }
        })
    })
}

async function fn() {
    try {
        let data1 = await getPromise("a")
        console.log(data1);

        let data2 = await getPromise("b")
        console.log(data2);

        let data3 = await getPromise("c")
        console.log(data3);

        let data4 = await getPromise("d")
        console.log(data4);

    } catch (err) {
        console.log(err);
    }
}

fn()